// ChessXMLGenerator.h
//
// Created By: Jeremy Butler
// Created On: 23-Mar-2011
//
// An chess game XML file generator used to save chess games.

#ifndef XML_GEN_H
#define XML_GEN_H

#include <string>
#include "Game.h"
using namespace std;

class ChessXMLGenerator {
private:
  string outputstring;
  const Game * game;
public:
  //! @brief No-Arg Constructor
  ChessXMLGenerator();

  //! @brief No-Arg Constructor
  ChessXMLGenerator(const Game * _game);

  //! @brief Copy Constructor
  //! @param other the ChessXMLGenerator to copy
  ChessXMLGenerator(const ChessXMLGenerator & other);

  //! @brief Operator = to copy a ChessXMLGenerator to this one.
  //! @param other the ChessXMLGenerator to copy.
  //! @return a reference to the newly copied ChessXMLGenerator
  ChessXMLGenerator & operator = (const ChessXMLGenerator & other);

  //! @brief Destructor
  ~ChessXMLGenerator();

  //! @brief Save an XML file to the hard disk representing the current state of the chess game.
  //! @param fileName The path where the file should be saved
  void GenerateChessXML(const string & fileName);

private:
  void GenerateBoardXML();
  void GenerateHistoryXML();
  void GeneratePieceXML(const Piece * piece, int row, int col, int indent);
  void GenerateMoveXML(const Move & move);
};

#endif /* XML_GEN_H */
